var t = require;
var e = module;
var o = exports;
var a,
    i =
        (this && this.__extends) ||
        ((a = function (t, e) {
            return (a =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                })(t, e);
        }),
        function (t, e) {
            a(t, e);
            function o() {
                this.constructor = t;
            }
            t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o());
        }),
    n =
        (this && this.__decorate) ||
        function (t, e, o, a) {
            var i,
                n = arguments.length,
                r = n < 3 ? e : null === a ? (a = Object.getOwnPropertyDescriptor(e, o)) : a;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, a);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (i = t[s]) && (r = (n < 3 ? i(r) : n > 3 ? i(e, o, r) : i(e, o)) || r);
            return n > 3 && r && Object.defineProperty(e, o, r), r;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var r = cc._decorator,
    s = r.ccclass,
    c = r.property,
    p =
        (r.menu,
        (function (t) {
            i(e, t);
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                e.lab = null;
                e.overView = [];
                e.unView = [];
                e.isFull = !1;
                e.lastTime = 0;
                e.allTime = 0;
                e.maxminutelimite = 60;
                e.systimelimite = 1e3;
                e.timeSep = ":";
                e.isPlayAnimal = !1;
                return e;
            }
            e.prototype.onLoad = function () {
                this.checkView();
            };
            e.prototype.onEnable = function () {};
            e.prototype.onDestroy = function () {
                EVUIEffView.offTarget(this);
            };
            e.prototype.updateView = function () {
                this.lab.string = this.getTimeStr();
            };
            e.prototype.checkView = function () {};
            e.prototype.setGetNode = function (t) {
                for (var e = 0; e < this.overView.length; e++) this.overView[e].active = t;
                for (e = 0; e < this.unView.length; e++) this.unView[e].active = !t;
            };
            e.prototype.checkTime = function () {
                this.isFull;
                this.isFull = Date.now() - this.lastTime > this.allTime;
                this.isFull;
            };
            e.prototype.getTimeStr = function () {
                return this.isFull
                    ? this.getFormat(0)
                    : this.getFormat(Math.floor((this.allTime - (Date.now() - this.lastTime)) / this.systimelimite));
            };
            e.prototype.getFormat = function (t) {
                return (
                    this.getFont(Math.floor(t / this.maxminutelimite)) +
                    this.timeSep +
                    this.getFont(t % this.maxminutelimite)
                );
            };
            e.prototype.getFont = function (t) {
                return 0 == t ? "00" : 1 == (t + "").length ? "0" + t : t + "";
            };
            e.prototype.update = function () {
                this.checkTime();
                this.updateView();
            };
            n([c(cc.Label)], e.prototype, "lab", void 0);
            n([c([cc.Node])], e.prototype, "overView", void 0);
            n([c([cc.Node])], e.prototype, "unView", void 0);
            return n([s], e);
        })(cc.Component));
o.default = p;
